;--------------------------------------------------------------------------- ; Sample Parse-O-Matic Script for TextHarvest ;--------------------------------------------------------------------------- ; ; This script uses the LookupFile and Lookup commands to replace the ; categories in the ThingsToDo.txt file. ; ;--------------------------------------------------------------------------- ; Check settings. Please see the script file ScriptSample01.txt if you do ; not understand how this section works; the techniques are explained there. ;--------------------------------------------------------------------------- Begin FirstLine = '' FirstLine = 'N' InputFileWanted = 'ThingsToDo.txt' X = Len $OptionX $OptionY $OptionZ Begin X <> 0 M1 = 'Please clear the /Keep /Delete and' $0A$0D M2 = '/Control input boxes and try this' $0A$0D M3 = 'this script again.' Stop M1 M2 M3 End Begin $ActualIFN ~ InputFileWanted M1 = 'Please try this script with the' $0A$0D M2 = 'input file ' InputFileWanted Stop M1 M2 End ; ; Output a header ; SepLine = Padded '' 80 'Left' '-' OutEnd SepLine OutEnd 'Things To Do Today' OutEnd SepLine End ;--------------------------------------------------------------------------- ; Get the data ;--------------------------------------------------------------------------- Category = $OutData[1 9] ; Get category Description = $OutData[10 999] ; Get description TrimChar Category ; Remove left & right spaces ;--------------------------------------------------------------------------- ; Do the lookup ;--------------------------------------------------------------------------- LookupFile 'MyTable' 'LufSample01.txt' 1 3 ; Specify table and columns RevCat = Lookup Category 'MyTable' ; Look up the revised category RevCat = Padded RevCat 12 'Right' ; Pad it out to 12 spaces ;--------------------------------------------------------------------------- ; Insert a blank line into the output whenever we get a new category ;--------------------------------------------------------------------------- Begin PreviousCat <> RevCat PreviousCat = RevCat ; Remember this category OutNull ; Skip a line End ;--------------------------------------------------------------------------- ; Output ;--------------------------------------------------------------------------- OutEnd RevCat Description